package com.xian.demo;

public class Test3 {
    public static void main(String[] args) {
        //需求：求最值

        int [] age = {21,15,18,36,95,55};
        System.out.println(getArraryMax(age));
    }

    public static int getArraryMax(int[] arr) {

        //第一个设为默认值
        int max = arr[0];
        //遍历数组
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        //返回结果
        return max;
    }
}
